{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "04b6bccf-4deb-47a8-aea4-a8fa25cfc3fb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "请输入华氏温度：  23\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-5.0\n"
     ]
    }
   ],
   "source": [
    "class Temperature:\n",
    "    def __init__(self, d):\n",
    "        self.degree = d\n",
    "    def ToCelsius(self):\n",
    "        return (self.degree - 32) * 5 / 9\n",
    "d1 = float(input(\"请输入华氏温度： \"))\n",
    "celsius = Temperature(d1)\n",
    "print(celsius.ToCelsius())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0bbc8866-ba9b-48f8-8e9d-38fa20a44cab",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
